package com.jinzhi.api.controller.aunt;

import com.jinzhi.common.utils.Result;
import com.jinzhi.jzweb.domain.JazAuntRefereeDO;
import com.jinzhi.jzweb.domain.JazUserOrderDO;
import com.jinzhi.jzweb.domain.vo.JazUserOrderVO;
import com.jinzhi.jzweb.service.JazAuntRefereeService;
import com.jinzhi.jzweb.service.JazUserOrderService;
import com.jinzhi.wxpay.vo.R;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @Author: mcf
 * @CreateTime: 2024/05/23
 * @Description: 合同、服务订单管理
 */
@RestController
@RequestMapping("/api/auntUserOrder")
@Api(value = "合同、服务订单管理", tags = "合同、服务订单管理")
public class AuntUserOrderController {

    private final JazUserOrderService jazUserOrderService; //月嫂表

    public AuntUserOrderController(JazUserOrderService jazUserOrderService){
        this.jazUserOrderService = jazUserOrderService;
    }

    @ApiOperation(value = "保洁上传图片接口", notes = "保洁上传图片接口")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功",response = JazUserOrderDO.class),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @PostMapping("/uploadPicture")
    public Result<?> uploadPicture(@RequestBody JazUserOrderDO jazUserOrderDO){
        if(jazUserOrderDO.getBeforePicture()!=null){
            jazUserOrderDO.setStatus(1);
        }

        return Result.ok(jazUserOrderService.updateById(jazUserOrderDO));
    }


    @ApiOperation(value = "阿姨端待签署合同数量", notes = "阿姨端待签署合同数量")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功",response = Integer.class),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @GetMapping("/auntConcludeStatusNum")
    public Result<?> auntConcludeStatusNum(){

        return Result.ok(jazUserOrderService.auntConcludeStatusNum());
    }


    @ApiOperation(value = "阿姨端修改合同为已读 orderIds多个以逗号隔开", notes = "阿姨端修改合同为已读 orderIds多个以逗号隔开")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderIds", value = "订单id,多个以逗号隔开", required = true, dataType = "String"),
    })
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功",response = Integer.class),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @PostMapping("/auntUpdateConcludeRead")
    public Result<?> auntUpdateConcludeRead(String orderIds){
        jazUserOrderService.auntUpdateConcludeRead(orderIds);
        return Result.ok();
    }


    @ApiOperation(value = "阿姨端待开始服务订单数量", notes = "阿姨端待开始服务订单数量")
    @ApiImplicitParams({
    })
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功",response = Integer.class),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @GetMapping("/auntOrderStatusNum")
    public Result<?> auntOrderStatusNum(){

        return Result.ok(jazUserOrderService.auntOrderStatusNum());
    }


    @ApiOperation(value = "阿姨端修改服务订单为已读 orderIds多个以逗号隔开", notes = "阿姨端修改服务订单为已读 orderIds多个以逗号隔开")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderIds", value = "订单id,多个以逗号隔开", required = true, dataType = "String"),
    })
    @ApiResponses({@ApiResponse(code = 0, message = "操作成功",response = Integer.class),
            @ApiResponse(code = 500, message = "服务器内部异常")})
    @ResponseBody
    @PostMapping("/auntUpdateOrderRead")
    public Result<?> auntUpdateOrderRead(String orderIds){
        jazUserOrderService.auntUpdateOrderRead(orderIds);
        return Result.ok();
    }





}
